动态规划,dp[i]表示前i个数字能够解码出来的字符串数,初始化dp[0] = dp[1] = 1。将数字串扫一遍,看每一个数字是否能与前一个数字构成一个有效的两位数,注意0的情况。 // Problem#: 1001 // Submission#: 2184264...
动态规划,dp[i]表示前i个数字能够解码出来的字符串数,初始化dp[0] = dp[1] = 1。将数字串扫一遍,看每一个数字是否能与前一个数字构成一个有效的两位数,注意0的情况。 // Problem#: 1001 // Submission#: 2184264...
<br />【数据结构/图论】 1310 Right-Heavy Tree 笛卡尔树相关,复杂度O(N)或O(NlogN)。 1426 Phone List 电话号码前缀检索,trie树相关。 1443 Printer Queue 基本队列操作。...
中大sicily编程平台上机考试资料整理,包含考试可能用到的各种算法,很实用!
原文出处:... *************************程序设计题************************* *************************数据结构************************* ...si
1002. 明明的随机数-中大sicily
第一次做中大的的题目。 这题题目是统计露出水面的岛屿的个数,如果是几个岛屿连在一起的就只算一个,一开始岛屿就是1。 如果一个岛屿的两边都是山的话+1 如果都是水的话-1 其他不用理 思路大概就是这样 注:...
20460. 双11购物-中大sicily
思路:首先创建两个函数operate() 和cycle(),其中operate()求得两个大数之和,cycle()将数组向后平移一位。首先初始化数组num,数组num存储兔子的数量,其中num[0]表示成熟兔子的数量,num[i]表示出生第i个月的数量...
#include<iostream> #include<string> #include<math.h> using namespace std; int m; void f(int p) { int count = 0; char out[1001]; if(m > 11) { if(p == 0) cout ; else { while(p > 0) { if((p % m) > 9) out...
//题目如下 1159. Sum Description Given several positive integers, calculate the sum of them. Input There are several test cases, one line for each case. For each line, the first number, N (N), is the ...
1344. 数列 Constraints Time Limit: 1 secs, Memory Limit: 32 MB Description 给定一个正整数k(3≤k≤15),把所有k的方幂及所有有限个互不相等的k的方幂之和构成一个递增的序列,例如,当k=3时,这个序列是...
标签: sicily算法
中大sicily online judge的刷题指南,里面介绍得很详细,不过,最近sicily好像不能外网访问了。
标签: sicily
在3~15的范围内,可以证明第k大的项就是将k转化成2进制表示,其2进制表示对应相应次幂的项是否需要累加 // Problem#: 1344 // Submission#: 2694846 // The source code is licensed under Creative Commons ...
1146. 采药 Constraints Time Limit: 1 secs, Memory Limit: 32 MB Description 辰辰是个天资聪颖的孩子,他的梦想是成为世界上最伟大的医师。为此,他想拜附近最有威望的医师为师。医师为了判断他的资质,给...
1001 函数求值 定义超级和函数F如下: F(0, n) = n,对于所有的正整数n.. F(k, n) = F(k – 1, 1) + F(k – 1, 2) + … + F(k – 1, n),对于所有的正整数k和n. 请实现下面Solution类中计算F(k, n)的函数(1...
在这里写的第一题,水题勿喷。解题思想是将数字排序,然后找到单独的那一个即可。 #include #include using namespace std; int main() { int n, a[105], j; while (1) { cin>>n; if (n == 0) ... cin>>
#include #include using namespace std; int mod(string big, int basic) { //int result; int len = big.length(); int div = 0; for (int i = 0; i ; ++i) { div = div * 10 + big[i] - '0';... di
Binary Tree Level Order Traversal II leetcode dfs bfs 原题链接 题意 Given a binary tree, return the bottom-up level order traversal of its nodes' values. (ie, from left to right,...
中大sicily第1813题题目在http://soj.me/show_problem.php?pid=1813&cid=#include#include#includeusing namespace std;int mi(int base,int pow);//幂函数int ctoi(char c);class Digit{public: Digit(int base,...
Binary Tree Level Order Traversal leetcode dfs bfs Binary Tree Level Order Traversal 题目链接 ...Given a binary tree, return the bottom-up level order traversal of i
由于中大的oj需要内网才能进去,就提供不了原始题目了,但是题目的意思就是说,开始有一对成年兔子,一对成年兔子每年能生一对幼兔,幼兔等m个月才成长为成年兔子,问d个月后总共有多少对兔子。 输入m d 2 3 ...
/* 简单的二叉树前序遍历,将节点封装好按照id存入数组即可 遍历之前需要找到根节点,可以像这样子做个父节点数组,也可以在输入时就推算根节点 */ /* Run Time: 0secs Run Memory: 332KB */ ...
中大ACM系统,一些使用建议 程序框架: 类型一:给定特定组数 类型二:多组数据,未知组数
题目链接:Binary Tree Level Order Traversal II Given a binary tree, return the bottom-up level order traversal of its nodes' values. (ie, from left to right, level by level from leaf to root). ...
我的方法比较麻烦,事实上是可以简化的 这里有一个别人写的:...#include <iostream> #include <stack> #include <iomanip>...using namespace std;......
9192. Three Lines 限制条件 时间限制: 1 秒, 内存限制: 256 兆 题目描述 Farmer John wants to monitor his N cows (1 ,000) using a new surveillance system he has purchased. The ith cow is located at...
Code in C Language for SOJ 1001. Alphacode
Description 最近叠罗汉成为一种时尚运动,于是有了叠罗汉社…… 或许有人比较out,不清楚这种运动的规则,简单来说:就是人叠人,第一个人站在地面,第二个人站在第一个人的肩膀,第三个人站在第二个人的肩膀,...
Description Given a valid identifier in C programs, please write a program to reverse it by respectively reversing two parts separated by ‘_’. Input The first line is an integer m, indicating the...